# This file is part of Appartition, a lightweight and portable backup tool.
# Copyright (C) 2012 Simon Grieger
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

###########################################################################
# Package: Appartition::Version
#
# This package stores version information. It also provides means to format
# this information for output.
###########################################################################

package Appartition::Version;

use 5.006;
use strict;
use warnings;

###########################################################################
# Group: Constants
###########################################################################

# String: NAME
#
# The program's name.
our $NAME = 'Appartition';

# String: CODE_NAME
#
# The program's code name. This name consists of only lower-case
# characters.
our $CODE_NAME = 'appartition';

# Integer: MAJOR
#
# The major version number. This is a non-negative integer.
our $MAJOR = 0;

# Integer: MINOR
#
# The minor version number. This is a non-negative integer.
our $MINOR = 1;

# Integer: MICRO
#
# The micro (or patch) version number. This is a non-negative integer.
our $MICRO = 0;

# Integer: YEAR
#
# The year this version was released in. This is an integer.
our $YEAR = 2012;

# Integer: MONTH
#
# The month this version was released in. This is an integer in the
# interval [1, 12].
our $MONTH = 2;

# Integer: DAY
#
# The day this version was released on. This is an integer in the interval
# [1, 31].
our $DAY = 5;

# Integer: FIRST_YEAR
#
# The year development started in. This is an integer.
our $FIRST_YEAR = 2012;

# Array: AUTHORS
#
# This array stores the list of authors.
our @AUTHORS = ('Simon Grieger');

###########################################################################
# Group: Functions
###########################################################################

# Function: get_version
#
# Returns the version number as a string. The string includes the program's
# name and the release date.
#
# Returns:
#
#   A string containing the version number, as described above.
sub get_version #()
  {
    return sprintf('%s %u.%u.%u (%04u-%02u-%02u)',
                   $NAME, $MAJOR, $MINOR, $MICRO,
                   $YEAR, $MONTH, $DAY);
  }

# Function: get_copyright
#
# Returns copyright information as a string.
#
# Returns:
#
#   A string containing copyright information.
sub get_copyright #()
  {
    my $years = ($FIRST_YEAR == $YEAR ?
                 sprintf('%04u', $YEAR) :
                 sprintf('%04u-%04u', $FIRST_YEAR, $YEAR));
    my $authors = join(', ', @AUTHORS);

    return sprintf('Copyright (C) %s %s', $years, $authors);
  }

1;
